package com.open.pokergames.comm.user

import android.content.Intent
import android.os.Bundle
import com.open.pokergames.biz.entity.MemberEntity
import com.open.pokergames.comm.repository.entity.ResultInfo
import com.open.pokergames.comm.user.adapters.UserSearchListClickItemAdapter
import com.open.pokergames.comm.userCenter.UserSearchActivity
import kotlinx.android.synthetic.main.activity_load_recycle_view_load_tip_white_bg_for_search.*
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode

class UserSearchSingleSelectedActivity : UserSearchActivity() {

    private var adapter: UserSearchListClickItemAdapter? = null

    override fun retData() {
        if (adapter!!.data != null && adapter!!.data.size > 0) {
            adapter!!.data = null
        }
    }

    override fun setAdapter() {
        adapter = UserSearchListClickItemAdapter(this)
        adapter!!.setOnSuperListener(this)
        loadingRecyclerView.adapter = adapter
    }

    override fun setAdapterData(data: MutableList<MemberEntity>) {
        adapter!!.data = data
    }

    override fun updateAdapterData(data: MutableList<MemberEntity>) {
        adapter!!.updateData(data)
    }

    override fun onClick(position: Int, itemData: MemberEntity, flag: String?) {
        val bundle = Bundle()
        bundle.putSerializable("item", itemData)
        val intentNew = Intent()
        intentNew.putExtras(bundle)
        setResult(200, intentNew)
        finish()
    }

    override fun doCancel() {
        super.doCancel()
        setResult(201)
        finish()
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public fun addRoomCardAddBusCallback(result: ResultInfo<String>) {
    }

}